- /* sdfatnhs.cpp by K.Tsuru */
- // function ID 3312 DRADIX
- /*********************************************************
- SDouble class
- inverse hyperbolic function atanh(x) by series expansion
- atanh(x) = 0.5*log{(1+x)/(1-x)} = x + x^3/3+x^5/5 + ...
- x can be negative and |x| < 1.0.
- ***********************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- static const char* func= "AtanhSeries";
- SDouble AtanhSeries(const SDouble& x){
- // if(x.SNSign() == 0) return x; do not check x == 0
- SDouble x1(x), x2(x*x), result(x), delta;
- if(x.NetRdxExp() > 0) x.SetError(x.DOMAIN_ERR, func, 3312); // |x| > 1.0
- x1.FixedPoint(x.RdxExp());
-
- ulong k = 3uL, mt = x.SlOpMaxValue();
-
- do{
- x1 *= x2;
- delta = DsDiv(x1, k);
- result += delta;
- if( (k += 2) >= mt ){
- result.SetError(result.NOT_CONVERGE, func, -3312);
- break;
- }
- } while(delta.Sign(3312));
-
- x.upToTerm = (k+1uL)/2uL;
- x1.PointFree(); //Must use the object which called FixedPoint().
- result.Reform(3312);
- return result;
- }
sdfatnhs.cpp : last modifiled at 2007/11/29 00:05:48(1,049 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).